const headers = {
    Accept: "application/json",
    "Content-Type": "application/json",
};

export const fetchGet = async (url, params = {}) => {
    let str = "";
    for (let key in params) {
        str += `${key}=${params[key]}&`;
    }
    const getUrl = url + "?" + str;
    const result = await fetch(getUrl, {
        method: "get",
        headers,
    });

    return result.json();
};
export const fetchPost = async (url, params = {}) => {
    const result = await fetch(url, {
        method: "post",
        body: JSON.stringify(params),
        headers,
    });
    return result.json();
};
